﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace ObservableUnitTests
{
    class NotifyPropertyChange: INotifyPropertyChanged
    {
        public NotifyPropertyChange(String name)
        {
            Name = name;
        }
        
        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler copy = PropertyChanged;
            if (copy != null)
            {
                copy(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public string Name
        {
            get;
            private set;
        }

        public void Notify()
        {
            OnPropertyChanged(Name);
        }

    }
}
